﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.59    费用减免信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_COL_FEESFREE: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_COL_FEESFREE()
		{}
		#region Model
		private long _id;
		private long _loanid;
		private long _proid;
		private long _conid;
		private decimal _actint;
		private decimal _actmanage;
		private decimal _actcapital;
		private decimal _leftcapital;
		private Nullable<DateTime> _accpaydate;
		private decimal _redcapital;
		private decimal _redint;
		private decimal _redmanage;
		private decimal _reddelayint;
		private decimal _redfailcharge;
		private decimal _reddelayamt;
		private decimal _reddonfee;
		private decimal _redextfee;
		private decimal _redchargefee;
		private decimal _totalreduce;
		private string _remark;
		private string _applyby;
		private Nullable<DateTime> _applydate;
		private int _status;
		private string _cancelby;
		private Nullable<DateTime> _canceltime;
		private string _cancelreason;
		private string _touser;
		private int _isuer;
		private long _returnid;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 放款记录IDTb_Loan_Main.ID
		/// </summary>
		[DataMember]
		public long LOANID
		{
			get{return _loanid;}
			set{
				if ( _loanid!= value)
				{
					 _loanid = value;
					OnPropertyChanged("LOANID");
				}
			}
		}
		/// <summary>
		/// 立项申请记录ID
		/// </summary>
		[DataMember]
		public long PROID
		{
			get{return _proid;}
			set{
				if ( _proid!= value)
				{
					 _proid = value;
					OnPropertyChanged("PROID");
				}
			}
		}
		/// <summary>
		/// 合同记录ID
		/// </summary>
		[DataMember]
		public long CONID
		{
			get{return _conid;}
			set{
				if ( _conid!= value)
				{
					 _conid = value;
					OnPropertyChanged("CONID");
				}
			}
		}
		/// <summary>
		/// 已还利息合计
		/// </summary>
		[DataMember]
		public decimal ACTINT
		{
			get{return _actint;}
			set{
				if ( _actint!= value)
				{
					 _actint = value;
					OnPropertyChanged("ACTINT");
				}
			}
		}
		/// <summary>
		/// 已还管理费合计
		/// </summary>
		[DataMember]
		public decimal ACTMANAGE
		{
			get{return _actmanage;}
			set{
				if ( _actmanage!= value)
				{
					 _actmanage = value;
					OnPropertyChanged("ACTMANAGE");
				}
			}
		}
		/// <summary>
		/// 已还本金合计
		/// </summary>
		[DataMember]
		public decimal ACTCAPITAL
		{
			get{return _actcapital;}
			set{
				if ( _actcapital!= value)
				{
					 _actcapital = value;
					OnPropertyChanged("ACTCAPITAL");
				}
			}
		}
		/// <summary>
		/// 结欠本金合计
		/// </summary>
		[DataMember]
		public decimal LEFTCAPITAL
		{
			get{return _leftcapital;}
			set{
				if ( _leftcapital!= value)
				{
					 _leftcapital = value;
					OnPropertyChanged("LEFTCAPITAL");
				}
			}
		}
		/// <summary>
		/// 客户承诺还款日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> ACCPAYDATE
		{
			get{return _accpaydate;}
			set{
				if ( _accpaydate!= value)
				{
					 _accpaydate = value;
					OnPropertyChanged("ACCPAYDATE");
				}
			}
		}
		/// <summary>
		/// 减免本金
		/// </summary>
		[DataMember]
		public decimal REDCAPITAL
		{
			get{return _redcapital;}
			set{
				if ( _redcapital!= value)
				{
					 _redcapital = value;
					OnPropertyChanged("REDCAPITAL");
				}
			}
		}
		/// <summary>
		/// 减免利息
		/// </summary>
		[DataMember]
		public decimal REDINT
		{
			get{return _redint;}
			set{
				if ( _redint!= value)
				{
					 _redint = value;
					OnPropertyChanged("REDINT");
				}
			}
		}
		/// <summary>
		/// 减免管理费
		/// </summary>
		[DataMember]
		public decimal REDMANAGE
		{
			get{return _redmanage;}
			set{
				if ( _redmanage!= value)
				{
					 _redmanage = value;
					OnPropertyChanged("REDMANAGE");
				}
			}
		}
		/// <summary>
		/// 减免逾期利息
		/// </summary>
		[DataMember]
		public decimal REDDELAYINT
		{
			get{return _reddelayint;}
			set{
				if ( _reddelayint!= value)
				{
					 _reddelayint = value;
					OnPropertyChanged("REDDELAYINT");
				}
			}
		}
		/// <summary>
		/// 减免扣款失败手续费
		/// </summary>
		[DataMember]
		public decimal REDFAILCHARGE
		{
			get{return _redfailcharge;}
			set{
				if ( _redfailcharge!= value)
				{
					 _redfailcharge = value;
					OnPropertyChanged("REDFAILCHARGE");
				}
			}
		}
		/// <summary>
		/// 减免提前结清违约金
		/// </summary>
		[DataMember]
		public decimal REDDELAYAMT
		{
			get{return _reddelayamt;}
			set{
				if ( _reddelayamt!= value)
				{
					 _reddelayamt = value;
					OnPropertyChanged("REDDELAYAMT");
				}
			}
		}
		/// <summary>
		/// 减免催收费
		/// </summary>
		[DataMember]
		public decimal REDDONFEE
		{
			get{return _reddonfee;}
			set{
				if ( _reddonfee!= value)
				{
					 _reddonfee = value;
					OnPropertyChanged("REDDONFEE");
				}
			}
		}
		/// <summary>
		/// 减免延期费
		/// </summary>
		[DataMember]
		public decimal REDEXTFEE
		{
			get{return _redextfee;}
			set{
				if ( _redextfee!= value)
				{
					 _redextfee = value;
					OnPropertyChanged("REDEXTFEE");
				}
			}
		}
		/// <summary>
		/// 减免手续费
		/// </summary>
		[DataMember]
		public decimal REDCHARGEFEE
		{
			get{return _redchargefee;}
			set{
				if ( _redchargefee!= value)
				{
					 _redchargefee = value;
					OnPropertyChanged("REDCHARGEFEE");
				}
			}
		}
		/// <summary>
		/// 减免合计
		/// </summary>
		[DataMember]
		public decimal TOTALREDUCE
		{
			get{return _totalreduce;}
			set{
				if ( _totalreduce!= value)
				{
					 _totalreduce = value;
					OnPropertyChanged("TOTALREDUCE");
				}
			}
		}
		/// <summary>
		/// 备注
		/// </summary>
		[DataMember]
		public string REMARK
		{
			get{return _remark;}
			set{
				if ( _remark!= value)
				{
					 _remark = value;
					OnPropertyChanged("REMARK");
				}
			}
		}
		/// <summary>
		/// 申请人
		/// </summary>
		[DataMember]
		public string APPLYBY
		{
			get{return _applyby;}
			set{
				if ( _applyby!= value)
				{
					 _applyby = value;
					OnPropertyChanged("APPLYBY");
				}
			}
		}
		/// <summary>
		/// 申请日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> APPLYDATE
		{
			get{return _applydate;}
			set{
				if ( _applydate!= value)
				{
					 _applydate = value;
					OnPropertyChanged("APPLYDATE");
				}
			}
		}
		/// <summary>
		/// 状态0保存，1已提交，2同意，3拒绝，4作废
		/// </summary>
		[DataMember]
		public int STATUS
		{
			get{return _status;}
			set{
				if ( _status!= value)
				{
					 _status = value;
					OnPropertyChanged("STATUS");
				}
			}
		}
		/// <summary>
		/// 作废人
		/// </summary>
		[DataMember]
		public string CANCELBY
		{
			get{return _cancelby;}
			set{
				if ( _cancelby!= value)
				{
					 _cancelby = value;
					OnPropertyChanged("CANCELBY");
				}
			}
		}
		/// <summary>
		/// 作废时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CANCELTIME
		{
			get{return _canceltime;}
			set{
				if ( _canceltime!= value)
				{
					 _canceltime = value;
					OnPropertyChanged("CANCELTIME");
				}
			}
		}
		/// <summary>
		/// 作废原因
		/// </summary>
		[DataMember]
		public string CANCELREASON
		{
			get{return _cancelreason;}
			set{
				if ( _cancelreason!= value)
				{
					 _cancelreason = value;
					OnPropertyChanged("CANCELREASON");
				}
			}
		}
		/// <summary>
		/// 提交到
		/// </summary>
		[DataMember]
		public string TOUSER
		{
			get{return _touser;}
			set{
				if ( _touser!= value)
				{
					 _touser = value;
					OnPropertyChanged("TOUSER");
				}
			}
		}
		/// <summary>
		/// 是否已使用0否，1是
		/// </summary>
		[DataMember]
		public int ISUER
		{
			get{return _isuer;}
			set{
				if ( _isuer!= value)
				{
					 _isuer = value;
					OnPropertyChanged("ISUER");
				}
			}
		}
		/// <summary>
		/// 收回记录ID
		/// </summary>
		[DataMember]
		public long RETURNID
		{
			get{return _returnid;}
			set{
				if ( _returnid!= value)
				{
					 _returnid = value;
					OnPropertyChanged("RETURNID");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

